package com.ruoyi.system.wnjk.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.system.wnjk.domain.po.PhysicalOrder;
import com.ruoyi.system.wnjk.mapper.PhysicalOrderMapper;
import com.ruoyi.system.wnjk.service.IWnjkPhysicalExaminationOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 体检订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-08
 */
@Service
public class WnjkPhysicalExaminationOrderServiceImpl implements IWnjkPhysicalExaminationOrderService
{
    @Autowired
    private PhysicalOrderMapper wnjkPhysicalExaminationOrderMapper;

    /**
     * 查询体检订单
     * 
     * @param orderId 体检订单主键
     * @return 体检订单
     */
    @Override
    public PhysicalOrder selectWnjkPhysicalExaminationOrderByOrderId(String orderId)
    {
        return wnjkPhysicalExaminationOrderMapper.selectWnjkPhysicalExaminationOrderByOrderId(orderId);
    }

    /**
     * 查询体检订单列表
     * 
     * @param wnjkPhysicalExaminationOrder 体检订单
     * @return 体检订单
     */
    @Override
    public List<PhysicalOrder> selectWnjkPhysicalExaminationOrderList(PhysicalOrder wnjkPhysicalExaminationOrder)
    {
        return wnjkPhysicalExaminationOrderMapper.selectWnjkPhysicalExaminationOrderList(wnjkPhysicalExaminationOrder);
    }

    /**
     * 新增体检订单
     * 
     * @param wnjkPhysicalExaminationOrder 体检订单
     * @return 结果
     */
    @Override
    public int insertWnjkPhysicalExaminationOrder(PhysicalOrder wnjkPhysicalExaminationOrder)
    {
        return wnjkPhysicalExaminationOrderMapper.insertWnjkPhysicalExaminationOrder(wnjkPhysicalExaminationOrder);
    }

    /**
     * 修改体检订单
     * 
     * @param wnjkPhysicalExaminationOrder 体检订单
     * @return 结果
     */
    @Override
    public int updateWnjkPhysicalExaminationOrder(PhysicalOrder wnjkPhysicalExaminationOrder)
    {
        return wnjkPhysicalExaminationOrderMapper.updateWnjkPhysicalExaminationOrder(wnjkPhysicalExaminationOrder);
    }

    /**
     * 批量删除体检订单
     * 
     * @param orderIds 需要删除的体检订单主键
     * @return 结果
     */
    @Override
    public int deleteWnjkPhysicalExaminationOrderByOrderIds(String[] orderIds)
    {
        return wnjkPhysicalExaminationOrderMapper.deleteWnjkPhysicalExaminationOrderByOrderIds(orderIds);
    }

    /**
     * 删除体检订单信息
     * 
     * @param orderId 体检订单主键
     * @return 结果
     */
    @Override
    public int deleteWnjkPhysicalExaminationOrderByOrderId(String orderId)
    {
        return wnjkPhysicalExaminationOrderMapper.deleteWnjkPhysicalExaminationOrderByOrderId(orderId);
    }

    /**
     * 根据订单号查询体检订单
     * @param outTradeNo
     * @return
     */
    @Override
    public PhysicalOrder selectByOutTradeNo(String outTradeNo) {
        return wnjkPhysicalExaminationOrderMapper.selectWnjkPhysicalExaminationOrderByoutTradeNo(outTradeNo);
    }

    @Override
    public List<PhysicalOrder> selectWnjkPhysicalExaminationOrderByUserId(Long id) {
        return wnjkPhysicalExaminationOrderMapper.selectWnjkPhysicalExaminationOrderByUserId(id);
    }

    @Override
    public List<PhysicalOrder> selectExpiredOrders() {
        return wnjkPhysicalExaminationOrderMapper.selectExpiredOrders(new Date());
    }

    @Override
    public int updateExpiredOrder(PhysicalOrder order) {
        return wnjkPhysicalExaminationOrderMapper.updateExpiredOrder(order);
    }

    @Override
    public List<PhysicalOrder> selectAllOrders() {
        return wnjkPhysicalExaminationOrderMapper.selectWnjkPhysicalExaminationAllOrderList();
    }
}